<?php
	/* Set a flag so that we know that application entrance was the index page */
	$index = true;
	/* Define application level variables */
	require_once './application.php';
	/* Check to see if we have a user */
	if (isset($_SESSION['user']))
	{
		include('desktop.php');
	}
	else
	{
		if (isset($_POST['submit']))
		{
			$user = new AJD_User($_POST['username'],$_POST['pwd'],$_GLOBALS['app']);
			$res = $user->login();
			if ($res)
			{
				$_SESSION['user'] = $user;
				include('desktop.php');
			}
			else
			{
				include('login.php');
			}
		}
		else {
			include('login.php');
		}
	}
?>
